package com.soft.sitegenerator.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.soft.sitegenerator.Component;
import com.soft.sitegenerator.DataBaseComponent;
import com.soft.sitegenerator.business.hibernate.WebSite;
import com.soft.sitegenerator.form.WebSiteListForm;

public class WebSiteListAction extends Action {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		WebSiteListForm webSiteListForm = (WebSiteListForm) form;

		Component component = new DataBaseComponent();
		WebSite webSite = (WebSite) component.getBean("webSitesHib");

		webSiteListForm.setWebSites(webSite.findAll());

		return mapping.findForward("showList");
	}

}